package com.kanshu.ksgb.fastread.doudou.module.bookcity.adapter;

import android.content.Context;

import com.dl7.recycler.adapter.BaseQuickAdapter;
import com.dl7.recycler.adapter.BaseViewHolder;
import com.kanshu.ksgb.fastread.doudou.R;
import com.kanshu.ksgb.fastread.doudou.common.imageloader.GlideImageLoader;
import com.kanshu.ksgb.fastread.doudou.common.business.commonbean.BookInfo;
import com.kanshu.ksgb.fastread.doudou.common.business.utils.BookUtils;

import java.util.List;

/**
 * 万人之选适配器
 * Created by wcy on 18/5/16.
 */
public class SelectedBottomAdapter extends BaseQuickAdapter<BookInfo> {
    public SelectedBottomAdapter(Context context, List<BookInfo> data) {
        super(context, data);
    }

    @Override
    protected int attachLayoutRes() {
        return R.layout.item_book_layout;
    }

    @Override
    protected void convert(BaseViewHolder holder, BookInfo item, int position) {
        holder.setText(R.id.book_title, item.book_title).setText(R.id.book_desc, item.book_intro)
        .setText(R.id.author, item.author_name).setText(R.id.book_label, BookUtils.getBookLabel(item))
        .setText(R.id.book_status, BookUtils.getBookStatus(item));
        BookUtils.setStatusBg(holder.getView(R.id.book_status), item);
        GlideImageLoader.load(item.cover_url, holder.getView(R.id.cover));
        holder.setVisible(R.id.bottom_container, true);
    }
}
